package com.smm.actions;

import java.awt.Cursor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import com.smm.application.SimpleMovieManager;
import com.smm.gui.Screen;

public class GetFilesListener implements ActionListener {
	private Screen frame;
	private SimpleMovieManager sm;
	
	public GetFilesListener(Screen frame,SimpleMovieManager sm) {
		this.frame = frame;
		this.sm = sm;
	}
	@Override
	public void actionPerformed(ActionEvent arg0) {
		frame.lblStatusReady.setText("Status : Updating your media files");
		String path = sm.choosePath();
		frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
		frame.repaint();
		if (path != "cancel") {
			frame.textField.setText(path);
			sm.getSearchFolder(path);
			frame.setCursor(Cursor.getDefaultCursor());
			sm.updateTree();
		} else {
			frame.setCursor(Cursor.getDefaultCursor());
		}
		frame.lblStatusReady.setText("Status : ");
			
	}

}
